﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SPMS.Log.Core
{
    /// <summary>
    /// 日志输出器可连接接口
    /// </summary>
    /// <remarks>用于将日志输出器连接到特定的对象上</remarks>
    /// <history>
    /// [zanezeng]               2009/9/24 17:41    创建
    /// </history>
    public interface ILogAppenderAttachable
    {
        #region ---Property

        /// <summary>
        /// 获得关联的所有日志输出器
        /// </summary>
        /// <value>关联的所有日志输出器</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/25 12:11    创建
        /// </history>
        ILogAppender[] Appenders
        {
            get;
        }

        #endregion

        #region ---Method

        /// <summary>
        /// 获得给定名称的日志输出器
        /// </summary>
        /// <param name="name">要获得的日志输出器的名称</param>
        /// <returns>给定名称的日志输出器</returns>
        /// <remarks></remarks>
        /// <exception cref="ArgumentNullException"><paramref name="name"/>为空字符串或者为<c>null</c>引用。</exception>
        /// <history>
        /// [zanezeng]               2009/9/25 12:18    创建
        /// </history>
        ILogAppender GetAppender(string name);

        /// <summary>
        /// 添加日志输出器
        /// </summary>
        /// <param name="appender">要添加的日志输出器。</param>
        /// <remarks></remarks>
        /// <exception cref="ArgumentNullException"><paramref name="appender"/>为<c>null</c>引用。</exception>
        /// <exception cref="ArgumentNullException"><paramref name="appender"/>的<see cref="ILogAppender.Name"/>为空字符串或者为<c>null</c>引用。</exception>
        /// <history>
        /// [zanezeng]               2009/9/25 12:12    创建
        /// </history>
        void AddAppender(ILogAppender appender);

        /// <summary>
        /// 删除指定日志输出器
        /// </summary>
        /// <param name="appender">要删除的日志输出器</param>
        /// <returns>
        /// 	<c>true</c>：删除成功<br/>
        /// 	<c>false</c>：删除失败
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="appender"/>为<c>null</c>引用。</exception>
        /// <exception cref="ArgumentNullException"><paramref name="appender"/>的<see cref="ILogAppender.Name"/>为空字符串或者为<c>null</c>引用。</exception>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/25 12:14    创建
        /// </history>
        bool RemoveAppender(ILogAppender appender);

        /// <summary>
        /// 删除给定名称的日志输出器
        /// </summary>
        /// <param name="name">要删除的日志输出器的名称</param>
        /// <exception cref="ArgumentNullException"><paramref name="name"/>为空字符串或者为<c>null</c>引用。</exception>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/25 12:17    创建
        /// </history>
        ILogAppender RemoveAppender(string name);

        /// <summary>
        /// 清除所有的日志输出器
        /// </summary>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/25 12:17    创建
        /// </history>
        void ClearAppenders();

        #endregion
    }
}
